import request from '@/utils/request';
import { stringify } from 'qs';
import { toFormData } from '@/utils/utils.jsx';

// 账号管理列表
export async function queryStoreMangeList(params) {
  return request(`/zjf-wms/store/page?${stringify(params)}`);
}

// 角色列表
export async function queryRoleList(params) {
  return request(`/blade-system/erprole/selectKv?${stringify(params)}`);
}

// 拿货员列表
export async function queryTakeUserList(params) {
  return request(`/blade-user/childUsers?${stringify(params)}`);
}

// 退货员列表
export async function queryRefundUserList(params) {
  return request(`/blade-system/erprole/selectKv?${stringify(params)}`);
}

//修改备注
export async function editRemark(params) {
  return request(`/zjf-wms/store/updateRemarkBatch`, {
    method: 'POST',
    data: params
  });
}

//单条信息修改
export async function editSingleMessage(params) {
  return request(`/zjf-wms/store/update`, {
    method: 'POST',
    data: params
  });
}

//批量修改拿货员
export async function updateTakeUserBatch(params) {
  return request(`/zjf-wms/store/updateTakeUserBatch`, {
    method: 'POST',
    data: params
  });
}

//批量修改退货员
export async function updateRefundUserBatch(params) {
  return request(`/zjf-wms/store/updateRefundUserBatch`, {
    method: 'POST',
    data: params
  });
}

//批量修改区域
export async function updateAreaBatch(params) {
  return request(`/zjf-wms/store/updateAreaBatch`, {
    method: 'POST',
    data: params
  });
}

//供应商直发店铺列表查询
export async function queryZhifaList(params) {
  return request(`/blade-goods/zhifastoreconfig/page?${stringify(params)}`);
}

//修改供应商直发开启自发和备注
export async function updateFactoryList(params) {
  return request(`/zjf-wms/store/storeZhiFa?${stringify(params)}`);
  return request(`/blade-goods/zhifastoreconfig/saveOrUpdate`, {
    method: 'POST',
    data: params
  });
}

//自定义地址
export async function costomizeAddressEdit(params) {
  return request(`/zjf-wms/store/updateCustomAddress`, {
    method: 'POST',
    data: params
  })
}

//是否展示线下支付字段
export async function queryIsOpenOfflinePay() {
    return request('/blade-user/usercfg/queryIsOpenOfflinePay');
  }

  //线下支付开关修改
export async function updateOfflinePaySwitch(params) {
    return request(`/zjf-wms/store/updateOfflinePaySwitch?${stringify(params)}`);
  }
  
//导入修改
export async function importExcel(params) {
    return request(`/zjf-wms/store/importExcel`, {
      method: 'POST',
      body: toFormData(params)
    })
  }
  
//是否允许自动推送订单打印-开关
export async function autoPush(params) {
    return request(`/zjf-wms/store/autoPush`, {
      method: 'POST',
      body: toFormData(params)
    })
  }

//区域编码列表排序
export async function getAreaListOp() {
  return request('/zjf-wms/storecodesort/list');
}

//区域编码模糊查询
export async function queryAreaCode(params ) {
  return request(`/zjf-wms/storecodesort/selectListByName?${stringify(params)}`);
}

//新增
export async function addAreaCodeOp(params) {
  return request(`/zjf-wms/storecodesort/save`, {
    method: 'POST',
    body: toFormData(params)
  })
}

//删除
export async function deleteAreaCodeOp(params) {
  return request(`/zjf-wms/storecodesort/delete`, {
    method: 'POST',
    body: toFormData(params)
  })
}

//区域编码列表排序
export async function sortAreaCodeOp(params) {
  return request(`/zjf-wms/storecodesort/updateBatch`, {
    method: 'POST',
    data: params
  })
}

//模糊查询下拉供应商列表 storeName：供应商名称（门店管理)
export async function queryStoreFactoryList(params) {
    return request(`/blade-goods/zjfstore/list/store/fuzzyQueryPage?${stringify(params)}`);
  }  

//退款抵扣开关
export async function updateDeductionSwitchOp(params) {
  return request(`/zjf-wms/store/updateDeductionSwitch?${stringify(params)}`);
}  

//门店编码模糊查询
export async function selectStoreAreasByName(params ) {
    return request(`/zjf-wms/store/selectStoreAreasByName?${stringify(params)}`);
  }

	//批量设置推送打印
export async function autoPushBatch(params) {
  return request(`/zjf-wms/store/autoPushBatch?${stringify(params)}`)
}

//查询用户代拿渠道列表
export async function queryTypeDaiNaChannel(params) {
    return request(`/zjf-wms/channel/queryTypeDaiNaChannel?${stringify(params)}`)
}

//批量修改代拿拿货员
export async function updateDaiNaUserBatch(params) {
    return request(`/zjf-wms/store/updateDaiNaUserBatch`, {
      method: 'POST',
      data: params
    })
  }

//批量设置代拿
export async function updateDaiNa(params) {
    return request(`/zjf-wms/store/updateDaiNa`, {
      method: 'POST',
      data: params
    })
  }

//批量设置代拿(筛选条件)
export async function screenUpdateDaiNa(params) {
    return request(`/zjf-wms/store/screenUpdateDaiNa?${stringify(params)}`)
}

  //代拿开关修改
export async function updateDaiNaSwitch(params) {
    return request(`/zjf-wms/store/updateDaiNaSwitch?${stringify(params)}`)
}


//更新企微群推送用户id
export async function updateWechatUserId(params) {
    return request(`/zjf-wms/store/updateWechatUserId`, {
      method: 'POST',
      data: params
    })
  }

  //批量更新企微群推送用户id
export async function batchUpdateWechatUserId(params) {
    return request(`/zjf-wms/store/batchUpdateWechatUserId`, {
      method: 'POST',
      data: params
    })
  }

// 修改待拿货数据同步供应商标识
export async function updateUnpickDisplay(params) {
  return request(`/zjf-wms/store/updateUnpickDisplay`, {
    method: 'POST',
    data: params
  })
}

// 批量修改待拿货数据同步供应商标识
export async function batchUpdateUnpickDisplay(params) {
  return request(`/zjf-wms/store/batchUpdateUnpickDisplay`, {
    method: 'POST',
    data: params
  })
}

// 批量设置线下支付
export async function batchUpdateOfflinePaySwitch(params) {
  return request(`/zjf-wms/store/batchUpdateOfflinePaySwitch`, {
    method: 'POST',
    data: params
  })
}
